package com.yami.shop.api.controller;

import com.yami.shop.bean.meituan.ShopScope;
import com.yami.shop.bean.meituan.ShopStatusResponse;
import com.yami.shop.service.ShopStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/MeituanShopStatus")
public class ShopStatusCallbackController {

    @Autowired
    private ShopStatusService shopStatusService;

    //获取订单状态改变回调
    @PostMapping("/getShopStatus")
    public ResponseEntity<Map> getOrderStatus(ShopStatusResponse shopStatusResponse){
        Map map = new HashMap();
        map.put("code","0");
        if(shopStatusResponse!=null){
            shopStatusResponse.setCreateTime(new Date());
            shopStatusService.saveOrUpdate(shopStatusResponse);
        }
        return ResponseEntity.ok(map);
    }

}
